<%@page pageEncoding="UTF-8" contentType="text/html; UTF-8" isELIgnored="false" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>夺冠时刻 - 荣耀瞬间</title>
    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-2.2.3.min.js"></script>
    <style>
        :root {
            --primary: #f5a134;
            --secondary: #c94d0a;
            --accent: #ffc107;
            --light: #f8f9fa;
            --dark: #212529;
            --shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
            --transition: all 0.3s ease;
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
            line-height: 1.6;
            background: linear-gradient(135deg, #fae18e 0%, #e4edf5 100%);
            color: var(--dark);
            min-height: 100vh;
            padding-bottom: 2rem;
        }

        /* 头部样式 */
        header {
            background: linear-gradient(135deg, #cb2711 0%, #fcca25 100%);
            color: white;
            padding: 2rem 1rem;
            text-align: center;
            box-shadow: var(--shadow);
            margin-bottom: 2rem;
            position: relative;
            overflow: hidden;
        }

        header::before {
            content: "";
            position: absolute;
            top: -50%;
            left: -50%;
            width: 200%;
            height: 200%;
            background: radial-gradient(circle, transparent 20%, rgba(255,255,255,0.1) 20%, rgba(255,255,255,0.1) 21%, transparent 21%);
            background-size: 40px 40px;
            transform: rotate(30deg);
            z-index: 0;
        }

        .header-content {
            position: relative;
            z-index: 1;
        }

        h1 {
            font-size: 2.8rem;
            margin-bottom: 0.5rem;
            text-shadow: 0 2px 4px rgba(0,0,0,0.3);
            letter-spacing: 1px;
        }

        .subtitle {
            font-size: 1.2rem;
            opacity: 0.9;
            max-width: 600px;
            margin: 0 auto;
        }

        /* 导航按钮样式 */
        .upload-container {
            text-align: center;
            margin: 2rem auto;
        }

        .upload-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(to right, var(--secondary), #f5a134);
            color: white;
            font-size: 1.1rem;
            font-weight: 600;
            padding: 0.8rem 2rem;
            border: none;
            border-radius: 50px;
            cursor: pointer;
            transition: var(--transition);
            box-shadow: var(--shadow);
            text-decoration: none;
            position: relative;
            overflow: hidden;
            z-index: 1;
        }

        .upload-btn:hover {
            transform: translateY(-3px);
            box-shadow: 0 7px 15px rgba(201, 10, 45, 0.4);
        }

        .upload-btn::after {
            content: "";
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: linear-gradient(to right, #e74c3c, var(--secondary));
            opacity: 0;
            transition: var(--transition);
            z-index: -1;
        }

        .upload-btn:hover::after {
            opacity: 1;
        }

        .upload-btn i {
            margin-right: 8px;
            font-size: 1.2rem;
        }

        /* 图片网格布局 */
        .gallery-container {
            max-width: 1400px;
            margin: 0 auto;
            padding: 0 1.5rem;
        }

        .gallery-grid {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
            gap: 2rem;
            margin-top: 1rem;
        }

        /* 图片卡片样式 */
        .photo-card {
            background: white;
            border-radius: 12px;
            overflow: hidden;
            box-shadow: var(--shadow);
            transition: var(--transition);
            position: relative;
            height: 350px;
            display: flex;
            flex-direction: column;
        }

        .photo-card:hover {
            transform: translateY(-10px);
            box-shadow: 0 12px 25px rgba(0, 0, 0, 0.2);
        }

        .photo-container {
            flex: 1;
            overflow: hidden;
            position: relative;
        }

        .photo-container img {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: var(--transition);
        }

        .photo-card:hover .photo-container img {
            transform: scale(1.05);
        }

        .overlay {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
            color: white;
            padding: 1.5rem 1rem 1rem;
            opacity: 0;
            transform: translateY(20px);
            transition: var(--transition);
        }

        .photo-card:hover .overlay {
            opacity: 1;
            transform: translateY(0);
        }

        .filename {
            font-size: 0.9rem;
            font-weight: 500;
            margin-bottom: 0.3rem;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .download-hint {
            font-size: 0.85rem;
            opacity: 0.8;
        }

        /* 底部样式 */
        footer {
            text-align: center;
            padding: 2rem 0;
            margin-top: 3rem;
            color: #6c757d;
            font-size: 0.9rem;
            border-top: 1px solid rgba(0,0,0,0.1);
            max-width: 1200px;
            margin-left: auto;
            margin-right: auto;
        }

        /* 响应式调整 */
        @media (max-width: 768px) {
            .gallery-grid {
                grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
                gap: 1.5rem;
            }

            h1 {
                font-size: 2.2rem;
            }

            .subtitle {
                font-size: 1rem;
            }
        }

        @media (max-width: 480px) {
            .gallery-grid {
                grid-template-columns: 1fr;
            }

            h1 {
                font-size: 1.8rem;
            }

            .upload-btn {
                width: 90%;
                padding: 0.9rem;
            }
        }

        /* 空状态提示 */
        .empty-state {
            text-align: center;
            padding: 4rem 1rem;
            max-width: 600px;
            margin: 2rem auto;
            background: white;
            border-radius: 12px;
            box-shadow: var(--shadow);
        }

        .empty-state i {
            font-size: 4rem;
            color: #ced4da;
            margin-bottom: 1.5rem;
        }

        .empty-state h3 {
            color: var(--primary);
            margin-bottom: 1rem;
        }

        .empty-state p {
            color: #6c757d;
            margin-bottom: 1.5rem;
        }
    </style>
    <link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
</head>
<body>
<header>
    <div class="header-content">
        <h1>夺冠时刻</h1>
        <p class="subtitle">珍藏每一个荣耀瞬间，记录辉煌时刻</p>
    </div>
</header>
<button onclick="window.location.href='welcome'">返回首页</button>

<div class="upload-container">
    <button class="upload-btn">
        <i class="fas fa-cloud-upload-alt"></i>
        <a href="uploadPic" style="color: inherit; text-decoration: none;">上传新图片</a>
    </button>
</div>

<div class="gallery-container">
    <c:choose>
        <c:when test="${not empty filenames}">
            <div class="gallery-grid">
                <c:forEach items="${filenames}" var="filename">
                    <div class="photo-card">
                        <div class="photo-container">
                            <a href="download?fileName=${filename}">
                                <img src="download?fileName=${filename}" alt="夺冠时刻图片">
                            </a>
                            <div class="overlay">
                                <div class="filename">${filename}</div>
                                <div class="download-hint">点击图片下载原图</div>
                            </div>
                        </div>
                    </div>
                </c:forEach>
            </div>
        </c:when>
        <c:otherwise>
            <div class="empty-state">
                <i class="fas fa-trophy"></i>
                <h3>暂无图片</h3>
                <p>您还没有上传任何夺冠时刻图片，点击上方按钮上传第一张图片</p>
            </div>
        </c:otherwise>
    </c:choose>
</div>

<footer>
    <p>夺冠时刻 - 荣耀瞬间珍藏馆 | 记录每一个辉煌时刻</p>
</footer>

<script>
    // 添加简单的图片加载动画
    $(document).ready(function() {
        $(".photo-card").each(function(index) {
            $(this).css("opacity", 0);
            $(this).delay(100 * index).animate({opacity: 1}, 500);
        });

        // 添加悬停效果增强
        $(".photo-card").hover(
            function() {
                $(this).find(".overlay").css("opacity", "1").css("transform", "translateY(0)");
            },
            function() {
                $(this).find(".overlay").css("opacity", "0").css("transform", "translateY(20px)");
            }
        );
    });
</script>
</body>
</html>